﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Fixx.DTO.Parser;

namespace Fixx.Connector
{
	[Serializable]
    public class FixxSettings : IFixxSettings
    {
        private readonly string _username;
        public string Username {
            get { return this._username; } 
        }
        private readonly string _password;
        public string Password
        {
            get { return this._password; }
        }
        private readonly string _host;
        public string Host
        {
            get { return this._host; }
        }
        private readonly int _port;
        public int Port
        {
            get { return this._port; }
        }
		private readonly int _timeOut;
        public int TimeOut
        {
            get { return this._timeOut; }
        }
        public TransportLayer TransportLayer { get; private set; }
		public FixxParserFormat FixxParserFormat { get; private set; }

		public bool IncludeArchivedProjects { get; set; }
		public bool IncludeClosedIssues { get; set; }
		public bool IncludeResolvedIssues { get; set; }
		public bool OnlyIssuesAssignedToMe { get; set; }

		public FixxSettings(string username, string password, string host, int port)
			: this(username, password, host, port, TransportLayer.XML,60000) { }

		public FixxSettings(string username, string password, string host, int port, int timeout) 
			: this(username, password, host, port, TransportLayer.XML, timeout) { }
			
		public FixxSettings(string username, string password, string host, int port,TransportLayer transportLayer)
			: this(username, password, host, port, transportLayer, 60000) { }
			
		public FixxSettings(string username, string password, string host, int port, TransportLayer transportLayer, int timeout)
		{
			this._host = host;
			this._password = password;
			this._username = username;
			this._timeOut = timeout;
			this._port = port;
			this.TransportLayer = transportLayer;
			switch (this.TransportLayer)
			{
				case TransportLayer.JSON:
					this.FixxParserFormat = FixxParserFormat.JSON;
					break;
				default:
					this.FixxParserFormat = FixxParserFormat.XML;
					break;
			}
		}
        
        
    }
}
